home *** CD-ROM | disk | FTP | other *** search
/ Joystick Magazine 1996 May / cd joy 71No13.iso / pc / demos / eurosoc / source / sos.h < prev    next >
C/C++ Source or Header  |  1995-02-05  |  15KB  |  548 lines

  1. /****************************************************************************
  2.  
  3.    File              : sos.h
  4.  
  5.    Programmer(s)     : Don Fowler, Nick Skrepetos
  6.    Date              :
  7.  
  8.    Purpose           : Include Files For Zortech C++ Compiler
  9.  
  10.    Last Updated      :
  11.  
  12. ****************************************************************************
  13.                Copyright(c) 1993,1994 Human Machine Interfaces 
  14.                             All Rights Reserved
  15. ****************************************************************************/
  16.  
  17. #ifndef  _SOS_DEFINED   
  18. #define  _SOS_DEFINED   
  19. #include "sosdefs.h"
  20.  
  21. #pragma pack(4)
  22.  
  23. // error definition for sound operating system  
  24. #define  _SOS_ERR          -1
  25.  
  26. // number of drivers allowed to be open at one time
  27. #define  _SOS_MAX_DRIVERS  5
  28.  
  29. // structure definition for the capabilities
  30. typedef struct _tagCAPABILITIES
  31. {
  32.    BYTE  szDeviceName[ 32 ];  // device name
  33.    WORD  wDeviceVersion;      // device version
  34.    WORD  wBitsPerSample;      // bits per sound sample
  35.    WORD  wChannels;           // stereo/mono sound card
  36.    WORD  wMinRate;            // minimum rate
  37.    WORD  wMaxRate;            // maximum rate
  38.    WORD  wMixerOnBoard;       // board contains mixer
  39.    WORD  wMixerFlags;         // mixer capabilities
  40.    WORD  wFlags;              // miscellaneous flags   
  41.    short far * lpPortList;         // list of usable ports
  42.    short far * lpDMAList;          // list of usable dma channels
  43.    short far * lpIRQList;          // list of usable irq channels
  44.    short far * lpRateList;         // list of usable rates, -1 if any in min to max
  45.    WORD  fBackground;         // foreground or background driver
  46.    WORD  wDeviceID;           // ID for the device
  47.    WORD  wTimerID;            // ID for the timer
  48.    
  49. } _SOS_CAPABILITIES; 
  50.  
  51. // far pointer to the device capabilities structure
  52. typedef _SOS_CAPABILITIES far *  LPSOSDEVICECAPS;
  53.  
  54. // flag types for driver
  55. #define  _FLAGS_SIGNED              0x8000
  56.   
  57. // devices that can be loaded
  58. #define  _SOUND_BLASTER_8_MONO      0xe000
  59. #define  _SOUND_BLASTER_8_ST        0xe001
  60. #define  _SBPRO_8_ST                _SOUND_BLASTER_8_ST
  61. #define  _SBPRO_8_MONO              0xe00f
  62. #define  _SOUND_MASTER_II_8_MONO    0xe002
  63. #define  _MV_PAS_8_MONO             0xe003
  64. #define  _MV_PAS_16_MONO            0xe004
  65. #define  _MV_PAS_8_ST               0xe005
  66. #define  _MV_PAS_16_ST              0xe006
  67. #define  _ADLIB_GOLD_8_ST           0xe007
  68. #define  _ADLIB_GOLD_16_ST          0xe008
  69. #define  _ADLIB_GOLD_8_MONO         0xe009
  70. #define  _ADLIB_GOLD_16_MONO        0xe00a
  71. #define  _MICROSOFT_8_MONO          0xe00b
  72. #define  _MICROSOFT_8_ST            0xe00c
  73. #define  _MICROSOFT_16_MONO         0xe00d
  74. #define  _MICROSOFT_16_ST           0xe00e
  75. #define  _SOUND_SOURCE_8_MONO_PC    0xe010
  76. #define  _SOUND_SOURCE_8_MONO_TANDY 0xe011
  77. #define  _GENERAL_PORT_8_MONO       0xe012
  78. #define  _GENERAL_PORT_8_MONO_R     0xe013
  79. #define  _SIERRA_8_MONO             0xe014
  80. #define  _SB16_8_MONO               0xe015
  81. #define  _SB16_8_ST                 0xe016
  82. #define  _SB16_16_MONO              0xe017
  83. #define  _SB16_16_ST                0xe018
  84. #define  _ESS_AUDIODRIVE_8_MONO     0xe019
  85. #define  _ESS_AUDIODRIVE_8_ST       0xe01a
  86. #define  _ESS_AUDIODRIVE_16_MONO    0xe01b
  87. #define  _ESS_AUDIODRIVE_16_ST      0xe01c
  88. #define  _SOUNDSCAPE_8_MONO         0xe01d
  89. #define  _SOUNDSCAPE_8_ST           0xe01e
  90. #define  _SOUNDSCAPE_16_MONO        0xe01f
  91. #define  _SOUNDSCAPE_16_ST          0xe020
  92. #define  _RAP10_8_MONO              0xe021
  93. #define  _RAP10_16_MONO             0xe022
  94. #define  _GUS_8_MONO                0xe023
  95. #define  _GUS_8_ST                  0xe024
  96. #define  _GUS_16_MONO               0xe025
  97. #define  _GUS_16_ST                 0xe026
  98. #define  _GUS_MAX_8_MONO            0xe027
  99. #define  _GUS_MAX_8_ST              0xe028
  100. #define  _GUS_MAX_16_MONO           0xe029
  101. #define  _GUS_MAX_16_ST             0xe02a
  102. #define  _WAVEJAMMER_8_MONO         0xe02b
  103. #define  _WAVEJAMMER_8_ST           0xe02c
  104. #define  _WAVEJAMMER_16_MONO        0xe02d
  105. #define  _WAVEJAMMER_16_ST          0xe02e
  106. #define  _TEMPOCS_8_MONO            0xe02f
  107. #define  _TEMPOCS_8_ST              0xe030
  108. #define  _TEMPOCS_16_MONO           0xe031
  109. #define  _TEMPOCS_16_ST             0xe032
  110. #define  _WAVEJAMMERCD_8_MONO       0xe033
  111. #define  _WAVEJAMMERCD_8_ST         0xe034
  112. #define  _WAVEJAMMERCD_16_MONO      0xe035
  113. #define  _WAVEJAMMERCD_16_ST        0xe036
  114. #define  _SOUND_BLASTER_8_MONO_R    0xe050
  115. #define  _MICROSOFT_8_MONO_R        0xe051
  116. #define  _SOUND_MASTER_II_8_MONO_R  0xe052
  117. #define  _ADLIB_GOLD_8_MONO_R       0xe053
  118. #define  _MV_PAS_8_MONO_R           0xe054
  119. #define  _RAP10_8_MONO_R            0xe058
  120. #define  _RAP10_16_MONO_R           0xe059
  121. #define  _SB16_8_MONO_R             0xe05a
  122. #define  _SB16_8_ST_R               0xe05b
  123. #define  _SB16_16_MONO_R            0xe05c
  124. #define  _SB16_16_ST_R              0xe05d
  125. #define  _MV_PAS_16_MONO_R          0xe060
  126. #define  _SOUNDSCAPE_8_MONO_R       0xe061
  127. #define  _SOUNDSCAPE_8_ST_R         0xe062
  128. #define  _SOUNDSCAPE_16_MONO_R      0xe063
  129. #define  _SOUNDSCAPE_16_ST_R        0xe064
  130. #define  _ESS_AUDIODRIVE_8_MONO_R   0xe065
  131. #define  _ESS_AUDIODRIVE_8_ST_R     0xe066
  132. #define  _ESS_AUDIODRIVE_16_MONO_R  0xe067
  133. #define  _ESS_AUDIODRIVE_16_ST_R    0xe068
  134. #define  _SPEECH_THING_8_MONO       0xe090
  135. #define  _YAMAHA_8_MONO             0xe106
  136. #define  _INT_SPEAKER_8_MONO        0xe107
  137.  
  138. // call indexes for the loadable drivers
  139. enum
  140.    _DRV_INIT,
  141.    _DRV_UNINIT,
  142.    _DRV_SETRATE,
  143.    _DRV_SETACTION,
  144.    _DRV_START,
  145.    _DRV_STOP,
  146.    _DRV_PAUSE,
  147.    _DRV_RESUME,
  148.    _DRV_CAPABILITIES,
  149.    _DRV_PLAY_FOREGROUND,
  150.    _DRV_GET_FILL_INFO, 
  151.    _DRV_GET_CALL_FUNCTIONS,
  152.    _DRV_SET_CALL_FUNCTIONS
  153. };
  154.  
  155. // fill info
  156. typedef  struct   _tagFillInfo
  157.          {
  158.  
  159.             LPSTR lpFillHandler;                   // pointer to fill handler
  160.             LPWORD lpDMAFillCount;                 // pointer to dma count
  161.             LPSTR lpSampleList;                    // pointer to sample list
  162.             LPWORD lpDMAMasterVolume;              // pointer to dma count
  163.  
  164.          } _SOS_FILL_INFO;
  165.  
  166. // caps info structure
  167. typedef  struct   _tagCapsInfo
  168.          {
  169.  
  170.             LPSTR    lpPortList;                   // pointer to port list
  171.             LPSTR    lpDMAList;                    // pointer to DMA list
  172.             LPSTR    lpIRQList;                    // pointer to IRQ list
  173.             LPSTR    lpRateList;                   // pointer to rate list
  174.  
  175.          } _SOS_CAPS_INFO;
  176.  
  177. // maximum number of available voice
  178. #define  _MAX_VOICES    32
  179.  
  180. // structure definition
  181. typedef  struct   _tagSAMPLE
  182. {
  183.    LPSTR    samplePtr;                 // pointer to data buffer
  184.    LPSTR    sampleData;                // pointer to active data
  185.    LPSTR    sampleLoopPtr;             // pointer for loop back
  186.  
  187.    WORD     sampleLength;              // length of sample
  188.    WORD     sampleIndex;               // index into sample
  189.    WORD     sampleLoopLength;          // length of loop
  190.    
  191.    WORD     sampleBytesLeft;           // bytes left to play in sample
  192.  
  193.    WORD     sampleLoopPoint;           // byte count for loop point
  194.    WORD     sampleLoopEndLength;       // length of remaining chunk
  195.  
  196.    short    sampleFlags;               // control sample
  197.    short    sampleVolume;              // volume control
  198.    short    sampleID;                  // sample ID
  199.  
  200.    short    sampleChannel;             // channel to play sample on
  201.    short    sampleLoopCount;           // loop count
  202.    short    sampleLastFill;            // last fill position
  203.    VOID ( far cdecl * sampleCallback )( WORD, WORD, WORD ); // callback function for sample
  204.  
  205.    WORD     samplePitchAdd;
  206.    short    samplePitchFraction;
  207.  
  208.    short    samplePort;                // port to use for non-dma digitized
  209.  
  210.    WORD     sampleTotalBytes;
  211.    WORD     sampleByteLength;
  212.  
  213.    short    samplePanLocation;
  214.    short    samplePanSpeed;
  215.    short    samplePanDirection;
  216.    short    samplePanStart;
  217.    short    samplePanEnd;
  218.    
  219.    short    sampleDelayBytes;
  220.    short    sampleDelayRepeat;
  221.    
  222.    WORD     sampleADPCMPredicted;
  223.    short    sampleADPCMIndex;
  224.  
  225.    short    sampleRootNoteMIDI;   
  226.  
  227.    WORD  sampleTemp1;   
  228.    
  229. } _SOS_SAMPLE;
  230.  
  231. // enumeration for left or right channel
  232. enum
  233. {
  234.    _LEFT_CHANNEL,
  235.    _RIGHT_CHANNEL,
  236.    _CENTER_CHANNEL,
  237.    _INTERLEAVED
  238. };
  239.  
  240. // enumeration for foreground and background
  241. enum
  242.    _FOREGROUND,
  243.    _BACKGROUND 
  244. };
  245.  
  246. // defines for the sample flags
  247. #define  _ACTIVE           0x8000
  248. #define  _LOOPING          0x4000
  249. #define  _FIRST_TIME       0x2000
  250. #define  _PENDING_RELEASE  0x1000
  251. #define  _CONTINUE_BLOCK   0x0800
  252. #define  _PITCH_SHIFT      0x0400
  253. #define  _PANNING          0x0200
  254. #define  _VOLUME           0x0100
  255. #define  _TRANSLATE16TO8   0x0080
  256. #define  _STAGE_LOOP       0x0040
  257. #define  _TRANSLATE8TO16   0x0020
  258. #define  _STEREOTOMONO     0x0010
  259.  
  260. // defines for the wParam flags 
  261. #define  _SINGLE_SAMPLE 0x01
  262.  
  263. #define  _SOS_DCAPS_AUTO_REINIT     0x01
  264. #define  _SOS_DCAPS_MPU_401         0x02
  265. #define  _SOS_DCAPS_OPL2            0x04
  266. #define  _SOS_DCAPS_OPL3            0x08
  267. #define  _SOS_DCAPS_OPL4            0x10
  268. #define  _SOS_DCAPS_WAVETABLE       0x20
  269. #define  _SOS_DCAPS_DL_SAMPLES      0x40
  270. #define  _SOS_DCAPS_FIFO_DEVICE     0x80
  271. #define  _SOS_DCAPS_ENV_NEEDED      0x100
  272. #define  _SOS_DCAPS_PSEUDO_DMA1     0x200
  273. #define  _SOS_DCAPS_SIGNED_DATA     0x8000
  274.  
  275. // file header structure
  276. typedef struct
  277. {
  278.    // name ID
  279.    BYTE  szName[ 32 ];
  280.  
  281.    // number of drivers in the file
  282.    WORD  wDrivers;
  283.  
  284.    // offset of first driver
  285.    WORD  lOffset;
  286.  
  287.    // size of the file
  288.    WORD  lFileSize;
  289.  
  290. } _FILEHEADER;
  291.  
  292. // driver header structure
  293. typedef struct
  294. {
  295.    // name ID
  296.    BYTE  szName[ 32 ];
  297.  
  298.    // offset of next driver
  299.    WORD  lNextDriver;
  300.  
  301.    // size of current driver
  302.    WORD  wSize;
  303.  
  304.    // id for the current device
  305.    WORD  wDeviceID;
  306.  
  307.    // id for the type of DOS extender
  308.    WORD  wExtenderType;
  309.  
  310. } _DRIVERHEADER;
  311.  
  312. // device hardware information
  313. typedef struct
  314. {
  315.    // port to be used
  316.    WORD  wPort;
  317.  
  318.    // irq to use
  319.    WORD  wIRQ;
  320.  
  321.    // dma channel to se
  322.    WORD  wDMA; 
  323.   
  324.    // extra parameter
  325.    WORD  wParam;
  326.  
  327. } _SOS_HARDWARE;
  328.  
  329. // structure definition for start sample
  330. typedef struct
  331. {
  332.    // pointer to sample
  333.    LPSTR lpSamplePtr;
  334.  
  335.    // size of the sample
  336.    WORD  dwSampleSize;
  337.  
  338.    // number of times to loop the sample -1 is infinite
  339.    WORD  wLoopCount;
  340.  
  341.    // channel to play sample on
  342.    WORD  wChannel;
  343.  
  344.    // volume to play sample at
  345.    WORD wVolume;
  346.  
  347.    // id for the sample
  348.    WORD  wSampleID;
  349.  
  350.    // far pointer to the callback function
  351.    VOID ( far cdecl *lpCallback )( WORD, WORD, WORD );
  352.  
  353.    // port to use if driver is a non-dma background driver
  354.    WORD  wSamplePort; 
  355.  
  356.    // flags field
  357.    WORD  wSampleFlags;
  358.  
  359.    // total length of sample including loops, etc..
  360.    WORD     dwSampleByteLength;
  361.  
  362.    // loop point for the sample
  363.    WORD  dwSampleLoopPoint;
  364.    WORD  dwSampleLoopLength;
  365.  
  366.    // pitch shifting components 
  367.    WORD     dwSamplePitchAdd;
  368.    WORD    wSamplePitchFraction;
  369.  
  370.    // pan components
  371.    WORD    wSamplePanLocation;
  372.    WORD    wSamplePanSpeed;
  373.    WORD    wSamplePanDirection;
  374.    WORD    wSamplePanStart;
  375.    WORD    wSamplePanEnd;
  376.    
  377.    // delay parts
  378.    WORD    wSampleDelayBytes;
  379.    WORD    wSampleDelayRepeat;
  380.  
  381.    // compression components   
  382.    WORD     dwSampleADPCMPredicted;
  383.    WORD    wSampleADPCMIndex;
  384.  
  385.    // root note for pitch shifting 
  386.    WORD    wSampleRootNoteMIDI;   
  387.  
  388.    // filler for future upgrades
  389.    WORD  dwSampleTemp1;   
  390.    WORD  dwSampleTemp2;   
  391.    WORD  dwSampleTemp3;   
  392.  
  393. } _SOS_START_SAMPLE;
  394.  
  395. // structure for initializing a driver
  396. typedef struct
  397. {  
  398.    WORD  wBufferSize;
  399.    LPSTR lpBuffer;
  400.    BOOL  wAllocateBuffer;
  401.    WORD  wSampleRate;
  402.    WORD  wParam;
  403.    LONG  dwParam;
  404.    VOID ( far *lpFillHandler )( VOID );
  405.    LPSTR lpDriverMemory;
  406.    LPSTR lpDriverMemoryCS;
  407.    LPSTR lpTimerMemory;
  408.    LPSTR lpTimerMemoryCS;
  409.    WORD  wTimerID;
  410.    WORD  wPhysical;
  411.  
  412. } _SOS_INIT_DRIVER;
  413.  
  414. // define for the timer types to use
  415. #define  _SOS_NORMAL_TIMER          0x00
  416.  
  417. // enumeration for the timer types
  418. enum
  419. {
  420.    _TIMER_8_MONO   =     0x1000,
  421.    _TIMER_8_ST,          
  422.    _TIMER_16_MONO,       
  423.    _TIMER_16_ST,         
  424.    _TIMER_8_MONO_ULAW,  
  425.    _TIMER_8_ST_ULAW,    
  426.    _TIMER_16_MONO_ULAW, 
  427.    _TIMER_16_ST_ULAW,   
  428.    _TIMER_8_MONO_REC,   
  429.    _TIMER_8_MONO_ULAW_REC,
  430.    _TIMER_UNDEFINED_1,      
  431.    _TIMER_UNDEFINED_2,
  432.    _TIMER_UNDEFINED_3,
  433.    _TIMER_UNDEFINED_4,
  434.    _TIMER_UNDEFINED_5,
  435.    _TIMER_UNDEFINED_6,
  436.    _TIMER_UNDEFINED_7,
  437.    _TIMER_UNDEFINED_8,
  438.    _TIMER_UNDEFINED_9,
  439.    _TIMER_UNDEFINED_A,
  440.    _TIMER_UNDEFINED_B,
  441.    _TIMER_UNDEFINED_C,
  442.    _TIMER_UNDEFINED_D,
  443.    _TIMER_UNDEFINED_E,
  444.    _TIMER_UNDEFINED_F,
  445.    _TIMER_UNDEFINED_10,
  446.    _TIMER_UNDEFINED_11,
  447.    _TIMER_UNDEFINED_12,
  448.    _TIMER_UNDEFINED_13,
  449.    _TIMER_UNDEFINED_14,
  450.    _TIMER_UNDEFINED_15,
  451.    _TIMER_UNDEFINED_16,
  452.    _TIMER_8_SOUND_SOURCE,
  453.    _TIMER_8_SOUND_SOURCE_TANDY,
  454.    _TIMER_8_GENERAL_PORT,
  455.    _TIMER_8_GENERAL_PORT_REC   
  456. };
  457.  
  458. // define for no slots available
  459. #define  _ERR_NO_SLOTS ( WORD )-1
  460.  
  461. // error codes for the system
  462. enum
  463. {
  464.    _ERR_NO_ERROR,
  465.    _ERR_DRIVER_NOT_LOADED,
  466.    _ERR_INVALID_POINTER,
  467.    _ERR_DETECT_INITIALIZED,
  468.    _ERR_FAIL_ON_FILE_OPEN,
  469.    _ERR_MEMORY_FAIL,
  470.    _ERR_INVALID_DRIVER_ID,
  471.    _ERR_NO_DRIVER_FOUND,
  472.    _ERR_DETECTION_FAILURE,
  473.    _ERR_DRIVER_LOADED,
  474.    _ERR_INVALID_HANDLE,
  475.    _ERR_NO_HANDLES,
  476.    _ERR_PAUSED,   
  477.    _ERR_NOT_PAUSED,
  478.    _ERR_INVALID_DATA,
  479.    _ERR_DRV_FILE_FAIL,
  480.    _ERR_INVALID_PORT,
  481.    _ERR_INVALID_IRQ,
  482.    _ERR_INVALID_DMA,
  483.    _ERR_INVALID_DMA_IRQ
  484. };   
  485.  
  486. // maximum number of timer events that can be registered 
  487. #define  _TIMER_MAX_EVENTS    0x10  
  488.  
  489. // flags for the debugging system
  490. #define  _SOS_DEBUG_NORMAL       0x0000
  491. #define  _SOS_DEBUG_NO_TIMER     0x0001
  492. #define  _SOS_TIMER_DPMI         0x0002
  493.  
  494. // define for types of DOS extenders
  495. #define  _SOS_RATIONAL           0x8000
  496. #define  _SOS_FLASHTECK          0x4000
  497.  
  498. // defines for the types of timers for different
  499. // dos extenders
  500. #define  _SOS_TIMER_NEAR         0x8000
  501. #define  _SOS_TIMER_FAR          0x4000
  502.  
  503. // values for callback information
  504. enum
  505. {
  506.    _SAMPLE_PROCESSED,
  507.    _SAMPLE_LOOPING,
  508.    _SAMPLE_DONE
  509. };
  510.  
  511. // define for special 18.2 callback rate to dos
  512. #define  _TIMER_DOS_RATE   0xff00
  513.  
  514. #pragma pack()
  515.  
  516. #pragma aux int_3 = "int 3"
  517.  
  518. #pragma pack( 1 ) 
  519. typedef struct
  520. {
  521.     unsigned       region_size;
  522.     unsigned       offset;
  523.     unsigned       segment;
  524.     unsigned short    number_available;
  525.     unsigned short number_used;
  526.     unsigned       page0;
  527.  
  528. } EVDS_STRUCT;
  529.  
  530. typedef struct 
  531. {
  532.     unsigned       region_size;
  533.     unsigned       offset;
  534.     unsigned short segment;
  535.     unsigned short    ID;
  536.     unsigned       physical;
  537.  
  538. } VDS_STRUCT;
  539.  
  540. #pragma pack() 
  541.  
  542. #include "sosdata.h"
  543. #include "sosfnct.h"
  544.  
  545. #endif
  546.